package org.hh.jga.adaptor;

import org.hh.jga.util.Pair;

import net.sf.jga.fn.BinaryFunctor;

/**
 * Compose two items into one pair
 * 
 * @author Hong Hong
 *
 * @param First item type
 * @param Second item type
 */
public class ComposePair<T1, T2> extends BinaryFunctor<T1, T2, Pair<T1, T2>> {

	private static final long serialVersionUID = -6036489177002324753L;

	@Override
	public Pair<T1, T2> fn(T1 arg1, T2 arg2) {
		return Pair.make_pair(arg1, arg2);
	}
    /**
     * Calls the Visitor's <code>visit(Project1st)</code> method, if it
     * implements the nested Visitor interface.
     */
    public void accept(net.sf.jga.fn.Visitor v) {
        if (v instanceof ComposePair.Visitor)
            ((ComposePair.Visitor)v).visit(this);
        else
            v.visit(this);
    }
    
    // Object overrides

    public String toString() {
        return "ComposePair";
    }
    
     // AcyclicVisitor
     
    /**
     * Interface for classes that may interpret an <b>Project1st</b> functor.
     */
    public interface Visitor extends net.sf.jga.fn.Visitor {
        public void visit(ComposePair<?,?> host);
    }

}
